/**
 * 拦截方法，触发条幅
 * @param str - Update Insert Del
 * @returns {boolean}
 */
export default {
    install(Vue, options) {
        Vue.prototype.$authCheck = function(str) {
            const thisPath = this.$route.meta && this.$route.meta.authLink
            if (!thisPath) return true // 没有就跳过权限
            const { adminInfo, adminAuth } = this.$store.getters && this.$store.getters
            const hasPermission = adminAuth.some(item => item.authorityUrl === thisPath && item[`authority${str}`] === 1)
            return !(adminInfo.adminId === 1 || hasPermission);
        }
    }
}
